public class e6 {
        public static void main(String[] args) {
            String str = "石家庄-武汉-哈尔滨";
            System.out.println("从第五个字符截取到末尾的结果:" + str.substring(4));
            System.out.println("从第五个字符截取到第六个字符的结果:" + str.substring(4,6));
            System.out.print("分割后的字符串数组中元素依次为：");
            String[] strArray = str.split("-");
            for (int i = 0; i< strArray.length;i++){
                if (i != strArray.length - 1){
                    System.out.print(strArray[i] + ",");
                }else{
                    System.out.print(strArray[i]);
                }
            }
        }
    }

